#pragma once

#include "Game/Process/RenderProcess.h"
#include "Render/Texture/Picture2DTexture.h"
#include "Render/Texture/RenderTarget.h"
#include "Render/Tradition/RHIRenderPass.h"
#include "Render/Tradition/GraphicsPipeline.h"
#include "Render/Texture/ColorRenderTarget.h"
#include "Render/Texture/CubemapTexture.h"
#include "Render/Texture/DepthRenderTarget.h"
#include "Render/Shader/RHIDescriptor.h"
#include "Render/Tradition/RHIFramebuffer.h"
#include "LocalEntity.h"


class NormalProcess : public RenderProcess
{
	DECLARE_PROCESS(NormalProcess)

	struct VertUbo
	{
		glm::mat4 model;
		glm::mat4 view;
		glm::mat4 proj;
		glm::vec4 lightPos;
		glm::vec4 cameraPos;
		glm::vec2 uvScale;
	};

	struct FragUbo
	{
		float heightScale;
		float parallaxBias;
		float numLayers;
		int32 mappingMode;
	};

public:

	float mHeightScale;

	float mParallaxBias;

	float mNumLayers;

	int32 mMappingMode;

	float mUScale;

	float mVScale;

protected:

	virtual void OnInit() override;

	virtual void OnTick(float deltaTime) override;

	virtual void OnResize() override;

protected:

	Entity* mLightEntity;

	RefCountPtr<VertexBuffer> mVertexBuffer;

	RefCountPtr<IndexBuffer> mIndexBuffer;

	RefCountPtr<RHIBuffer> mVertUboBuffer;

	RefCountPtr<RHIBuffer> mFragUboBuffer;

	RefCountPtr<RHISampler> mSampler;

	RefCountPtr<RHITexture> mColorTexture;

	RefCountPtr<RHITexture> mNormalTexture;

	RefCountPtr<RHITexture> mHightTexture;

	DescriptorMask mDescriptorMask;

	RefCountPtr<RHIDescriptor> mDescriptor;

	RefCountPtr<GraphicsPipeline> mPipeline;
};
